package com.gofun.report.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gofun.common.model.enums.CouponPriceTypeEnum;
import com.gofun.common.util.DateUtil;
import com.gofun.common.util.DecimalUtil;

import java.util.Date;

public class QueryMyCouponVo extends JsonVo{

	private String userCouponId;
	
	private String couponId;
	
	private String name;
	
	private String amount;
	
	private String amountDesc;
	
	private String useableStart;
	
	private String useAbleEnd;
	
	private Date useableStartDate;
	
	private Date useAbleEndDate;
	
	private String cityName;
	
	private String cityCode;
	
	private String memo;
	
	private Integer priceType;
	
	private Integer status;
	

	public String getUserCouponId() {
		return userCouponId;
	}

	public void setUserCouponId(String userCouponId) {
		this.userCouponId = userCouponId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAmount() {
//		DecimalFormat df = new DecimalFormat("###.0");  
//		return df.format(Double.valueOf(amount));
		return amount;
	}
	
	public void setAmount(String amount) {
		this.amount = amount;
	}

	public String getUseAbleEnd() {
		return DateUtil.stringDateUTC(Long.valueOf(useAbleEnd),"yyyy年MM月dd日");
	}

	public void setUseAbleEnd(String useAbleEnd) {
		this.useAbleEnd = useAbleEnd;
	}

	public String getCityName() {
		if("000".equals(cityCode)){
			return "全国通用";
		}
		return "仅限"+cityName+"使用";
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public String getCouponId() {
		return couponId;
	}

	public void setCouponId(String couponId) {
		this.couponId = couponId;
	}

	public String getUseableStart() {
		return DateUtil.stringDateUTC(Long.valueOf(useableStart),"yyyy年MM月dd日");
	}

	public void setUseableStart(String useableStart) {
		this.useableStart = useableStart;
	}

	public String getMemo() {
		return memo==null?"":memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	public String getAmountDesc() {
		amountDesc = amount+"元";
		if (priceType!=null){
			if(priceType==CouponPriceTypeEnum.FIXATION_PRICE.getIndex().intValue()){
				amountDesc = amount+"元";
			}
			if(priceType==CouponPriceTypeEnum.SALE_PRICE.getIndex().intValue()){
				amountDesc = DecimalUtil.format(DecimalUtil.div(Double.valueOf(amount),10))+"折";
			}
		}
		return amountDesc;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getPriceType() {
		return priceType;
	}

	public void setPriceType(Integer priceType) {
		this.priceType = priceType;
	}

	public void setAmountDesc(String amountDesc) {
		this.amountDesc = amountDesc;
	}
	@JsonIgnore
	public Date getUseableStartDate() {
		if(useableStart!=null){
			useableStartDate = DateUtil.utc2Date(Long.valueOf(useableStart));
		}
		
		return useableStartDate;
	}

	
	@JsonIgnore
	public Date getUseAbleEndDate() {
		if(useAbleEnd!=null){
			useAbleEndDate = DateUtil.utc2Date(Long.valueOf(useAbleEnd));
		}
		return useAbleEndDate;
	}

	
	
}
